<?php
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

//从Student表查询前面3条学生记录
$sql = "SELECT top 3 * FROM Student";
$result = $db->query($sql);
print_r($result->fetchAll(PDO::FETCH_ASSOC));